/*
 * @Author: your name
 * @Date: 2021-08-26 15:43:59
 * @LastEditTime: 2021-08-28 15:28:42
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \vue_study\src\network\order.js
 */
import {request} from './request'

//创建订单
export function createOrder(params){
    return request({
        url:"/api/orders",
        method:'post',
        params,
    })
}

//获取订单视图
export function getOrderPreview(){
    return request({
        url:"/api/orders/preview",
        method:'get',
    })
}

//订单支付
export function payOrder(order,params){
    return request({
        url:`/api/orders/${order}/pay`,
        method:'get',
        params
    })
}

//订单状态
export function payOrderStatus(order){
    return request({
        url:`/api/orders/${order}/status`,
        method:'get',
    })
}

//获取订单列表
export function getOrderList(params){
    return request({
        url:"/api/orders",
        method:'get',
        params,
    })
}

//订单详情
export function getOrderDetail(order){
    return request({
        url:`/api/orders/${order}`,
        method:'get',
        params:{
            include:'user,orderDetails.goods'
        },
    })
}

//确认订单
export function confirmOrder(order){
    return request({
        url:`/api/orders/${order}/confirm`,
        method:'patch',
    })
}

//获取路由信息
export function viewExpress(order){
    return request({
        url:`/api/orders/${order}/express`,
        method:'get',
    })
}